home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Tools & Goodies / ODFx / Sources / Content.h < prev    next >
Encoding:
Text File  |  1996-08-26  |  3.5 KB  |  133 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #define CONTENT_H
  12.  
  13. #ifndef DEFINES_K
  14. #include "Defines.k"
  15. #endif
  16.  
  17. // ----- Framework Includes -----
  18.  
  19. #ifndef FWCONTNT_H
  20. #include "FWContnt.h"
  21. #endif
  22.  
  23. //========================================================================================
  24. //    Forward Declarations
  25. //========================================================================================
  26.  
  27. class CODFxPart;
  28. class FW_CReadableStream;
  29.  
  30. //========================================================================================
  31. //    class CODFxContent
  32. //========================================================================================
  33.  
  34. class CODFxContent : public FW_CContent
  35. {
  36. //----------------------------------------------------------------------------------------
  37. //    Initialization/Destruction
  38. //
  39. public:
  40.     FW_DECLARE_AUTO(CODFxContent)
  41.     
  42.     CODFxContent(Environment* ev, CODFxPart* part);
  43.     virtual ~CODFxContent();
  44.  
  45. //----------------------------------------------------------------------------------------
  46. //    Inherited API
  47. //
  48. public:
  49.     virtual void        ExternalizeKind(Environment* ev,
  50.                                      ODStorageUnit* storageUnit,
  51.                                       FW_CKind* kind,
  52.                                      FW_StorageKinds storageKind,
  53.                                      FW_CPromise* promise,
  54.                                      FW_CCloneInfo* cloneInfo);
  55.     virtual FW_Boolean    InternalizeKind(Environment* ev,
  56.                                      ODStorageUnit* storageUnit, 
  57.                                       FW_CKind* kind,
  58.                                      FW_StorageKinds storageKind,
  59.                                      FW_CCloneInfo* cloneInfo);
  60.  
  61. //----------------------------------------------------------------------------------------
  62. //    New API
  63. //
  64.  
  65. public:
  66.  
  67.     enum { kMinPixPerRow = 64, kMidPixPerRow = 128, kMaxPixPerRow = 256 };
  68.     
  69.     // do not change maxColors without updating the content model
  70.     enum { kMinColors = 4, kMaxColors = 9 };
  71.  
  72. protected:
  73.  
  74.     typedef FW_CColor RegionColorArray[kMaxColors];
  75.  
  76. public:
  77.     
  78.     struct ODFXContentStruct
  79.     {
  80.         ODFXContentStruct(Boolean initColors = false);
  81.         
  82.         FW_Boolean            fVisibleGridLines;    // duh...
  83.         FW_Boolean            fUnused;            // set to false
  84.         short                fPixPerRow;            // either 128 or 96
  85.         short                fNumColors;            // either 4 or 9    
  86.         RegionColorArray    fColors;            // all 9 colors
  87.     };
  88.  
  89. public:
  90.  
  91.     void                 GetContentData(ODFXContentStruct& outData);
  92.     void                SetContentData(Environment* ev, const ODFXContentStruct& inData);
  93.     
  94.     Boolean                GetShowGridLines();
  95.     void                SetShowGridLines(Environment* ev, Boolean show);
  96.  
  97.     short                GetPixPerRow();
  98.     void                SetPixPerRow(Environment* ev, short inRes);
  99.     
  100.     void                RotateColors(Environment* ev);
  101.     
  102.     short                GetNumColors();
  103.     void                SetNumColors(Environment* ev, short numColors);
  104.  
  105.     FW_CPicture&        GetPictureData(Environment* ev);
  106.     void                InvalidatePicture(Environment* ev);
  107.  
  108.     void                GetColorData(RegionColorArray& colors);
  109.     void                SetColorData(Environment* ev, const RegionColorArray& colors);
  110.  
  111.     const FW_CColor&    GetColorData(short n);
  112.     void                SetColorData(Environment* ev, short n, const FW_CColor& newColor);
  113.  
  114.     void                ResetColorData(Environment* ev);
  115.  
  116. //----------------------------------------------------------------------------------------
  117. //    Data Members
  118. //
  119. protected:
  120.     
  121.     ODFXContentStruct    fContentData;
  122.     FW_CPicture            fPicture;
  123.     Boolean                fPictureValid;
  124.     CODFxPart*            fODFxPart;
  125. };
  126.  
  127. inline void CODFxContent::InvalidatePicture(Environment* ev)
  128. {
  129. FW_UNUSED(ev);
  130.     fPictureValid = false;
  131. }
  132.  
  133. #endif